import os
from PIL import Image

start_forest = (
    '-d' # use USB device (error if multiple devices connected)
    ' shell am start alipays://platformapi/startapp?appId=60000002 -a android.intent.action.VIEW'
)

os.makedirs('tmp', exist_ok=True)

def adb_run(cmd):
    os.system(f'adb {cmd}')

def pull_screenshot():
    adb_run('shell screencap -p /sdcard/screenshot.png')
    adb_run('pull /sdcard/screenshot.png ./tmp')
    return Image.open('./tmp/screenshot.png')
